<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <script src="js/danfo.js"></script>
    <script src="js/axios.min.js"></script>
    <title>Document</title>
</head>

<body>
<div id="plot_div"></div>

<script>
    axios.get("http://127.0.0.1:3000/backtest/dwan").then((response)=>{
        if(response && response.data) {
            //console.log('response.data: ', response.data);
            const layout = {
                title: "A financial charts",
                xaxis: {
                    title: "Date",
                },
                yaxis: {
                    title: "Count",
                },
            };
            const config = {
                columns: ["closePrice", "LEMA", "SEMA"],
            };
            let rawdata = response.data;
            let df = new dfd.DataFrame(rawdata,{
                columns:["openTime", "closePrice", "LEMA","SEMA"],
                dtypes:["int32","float32","float32","float32"],});

            df.setIndex({column:"openTime", drop:true, inplace:true});
            //console.log(new_df);
            df.plot("plot_div").line({ config, layout });
        }
    }).catch((err)=>{
        console.log(err);
    })
</script>
</body>
</html>